let createSectionComponent = {
    template: `
        <div class="section page">
            <div class="head">
               <div class="left" @click="back">
                    <span class="iconfont icon-ali-fanhui"></span>
                </div>
                <div class="title">CREATE SESSION</div>
                <div class="right"></div>
            </div>
            <div class="main">
                 {{viewState === 0?'Need User Confirmation?':''}}
                 {{viewState === 1?'Record Reminder?':''}} 
            </div>
            <div class="controls">
                <div class="btn">
                    <span @click="setBoolean(false)"  class="iconfont icon-ali-fork"></span>
                </div>
                 <div class="btn"><span @click="setBoolean(true)" class="iconfont icon-ali-duihao"></span></div>
            </div>
        </div>
    `,
    data() {
        return {
            viewState:0,
        }

    },
    computed: {},
    watch: {},
    mounted() {

    },
    activated() {

    },
    methods: {
        back(){
            this.$router.back()
        },
        setBoolean(boolean){
            switch (this.viewState){
                case 0:
                    section.body.conformation = boolean
                    section.body.id = this.$route.query.sectionId
                    if(boolean){
                        this.viewState = 1
                        section.update(section.body).then((r)=>{

                        })
                    }else{
                        section.update(section.body).then((r)=>{
                            this.$router.replace({
                                name: 'sections',
                                query:{
                                    sessionId: this.$route.query.sessionId
                                }
                            })
                        })

                    }
                    break
                case 1:
                    if(boolean){
                        this.$router.replace({
                            name: 'recorder',
                            query:{
                                recordType: 'reminder',
                                sectionId: this.$route.query.sectionId,
                                sessionId: this.$route.query.sessionId
                            }
                        })
                    } else {
                        this.$router.replace({
                            name: 'sections',
                            query:{
                                sessionId: this.$route.query.sessionId
                            }
                        })
                    }

                    break
            }
        }
    },
    components: {},
    beforeRouteLeave(to, from, next) {

        next();
    }
}


